User Roles and Atrributes

Once you have a logged in user, you can use some of the built in features to check roles, get attributes.

Here are a few examples.

enum Roles {
    ADMIN = 'admin',
    STANDARD = 'standard',
    READ_ONLY = 'read_only'
}

const useHasRole = auth.hasRole(Roles.ADMIN); // true/false

enum Attributes{
    CONTACT_PREFS = 'contactPreference'
}

const contactPreference = auth.getAttribute(Attributes.CONTACT_PREFS);
const attributeEquals = auth.attributeEquals(Attributes.CONTACT_PREFS, 'email')

Powered by Doctave